import ProForm, { ProFormText, ProFormTextArea } from '@ant-design/pro-form';

import React from 'react';

const validateMessages = {
  required: '${label}不能为空',
};

const RoleForm = ({ form, editable }) => {
  return (
    <ProForm
      initialValues={{
        parentId: 0,
      }}
      submitter={{ render: () => null }}
      validateMessages={validateMessages}
      form={form}
    >
      <ProFormText label="角色名称" name="name" rules={[{ required: true }]} />
      <ProFormText
        label="角色编码"
        name="code"
        disabled={editable}
        rules={[{ required: true }]}
      />
      <ProFormTextArea rows={5} label="菜单描述" name="description" />
    </ProForm>
  );
};

export default React.memo(RoleForm);
